package weaver.interfaces.jjy.duss.hr;

import com.sap.mw.jco.JCO;
import weaver.interfaces.jjy.duss.util.SAPConnPool;

import java.util.HashMap;
import java.util.Map;

/**
 * @Title: ecology-9-demo
 * @Company: 泛微软件
 * @author: weaver.Dusongsong
 * @version: 1.0
 * @CreateDate: 2020-04-11
 * @Description: ${description}
 * @ModifyLog:
 **/

public class ZFM_GET_TEXT_TABLE {
    public static Map execute(Map<String, String> map) {
        SAPConnPool SAPConn = new SAPConnPool();
        JCO.Client myConnection = SAPConn.getConnection();
        JCO.Function bapi = SAPConn.excuteBapi("ZFM_GET_TEXT_TABLE");
        JCO.ParameterList input = bapi.getImportParameterList();//输入参数和结构处理
        JCO.ParameterList inputtable = bapi.getTableParameterList();//输入表的处理

        //入参
        input.setValue("ZTHR004_BZBM", "IV_TABNAME");//表名
        input.setValue("BZBMID", "IV_FIELDNAME");//字段名
        //input.setValue("IV_SEL", "IV_SEL");//查询条件

        //执行函数
        myConnection.execute(bapi);
        JCO.ParameterList out = bapi.getExportParameterList();//输出参数和结构处理
        JCO.ParameterList Table00 = bapi.getTableParameterList();//输出表的处理
        //返回处理结果以及日志
        try{}catch (Exception e){
            e.printStackTrace();
        }
        Map<String, String> mapreturn = new HashMap<>();
        JCO.Table stu = Table00.getTable("ET_OUT");
        out.getValue("EV_MESSAGE");
        String VALUE = (String) stu.getValue("VALUE");//编码
        String TEXT = (String) stu.getValue("TEXT");//文本
        mapreturn.put("VALUE", VALUE);
        mapreturn.put("TEXT", TEXT);
        JCO.releaseClient(myConnection);
        return mapreturn;
    }

    public static void main(String[] args) {
        Map<String, String> map = new HashMap();
        Map<String, String> retrunmap = execute(map);
        System.out.println(retrunmap.toString());
    }
}
